package com.codingfuture.mvc_demo.service.impl;

import com.codingfuture.mvc_demo.dao.StudentDAO;
import com.codingfuture.mvc_demo.entity.Student;
import com.codingfuture.mvc_demo.service.StudentService;
import org.example.wrapper.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentDAO studentDAO;
    @Override
    public List<Student> selectAll() {
        QueryWrapper queryWrapper = new QueryWrapper();
        return studentDAO.selectByCondition(queryWrapper);
    }

    @Override
    public boolean insert(Student student) {
        return studentDAO.insert(student);
    }

    @Override
    public boolean updateById(Student student) {
        return studentDAO.updateById(student, student.getId());
    }

    @Override
    public boolean deleteById(Integer id) {
        return studentDAO.deleteById(id);
    }
}
